package com.zahb.qadx.ui.view.decoration;

import android.graphics.drawable.ColorDrawable;

import androidx.annotation.ColorInt;

/**
 * Created by zhoudawei on 2017/6/21.
 */

public class MColorDrawable extends ColorDrawable {

    private int mIntrinsicHeight = -1;
    private int mIntrinsicWidth = -1;

    public MColorDrawable(@ColorInt int color) {
        super(color);
    }

    @Override
    public int getIntrinsicHeight() {
        if (mIntrinsicHeight == -1)
            return super.getIntrinsicHeight();
        else
            return mIntrinsicHeight;
    }

    @Override
    public int getIntrinsicWidth() {
        if (mIntrinsicWidth == -1)
            return super.getIntrinsicWidth();
        else
            return mIntrinsicWidth;
    }

    public MColorDrawable setIntrinsicHeight(int intrinsicHeight) {
        this.mIntrinsicHeight = intrinsicHeight;
        return this;
    }

    public MColorDrawable setIntrinsicWidth(int intrinsicWidth) {
        this.mIntrinsicWidth = intrinsicWidth;
        return this;
    }
}
